/* 
 * File:   AutoAlbumMaker.h
 * Author: Claudio
 *
 * Created on February 25, 2013, 1:38 AM
 */

#ifndef AUTOALBUMMAKER_H
#define	AUTOALBUMMAKER_H

#include "Renderer.h"
#include "Document.h"
#include <string>
#include "Imagens.h"
#include <TimeClustering.h>
#include <SimmilarityClustering.h>
#include <cv.h>
#include <highgui.h>

struct Pontuation{
        int id1;
        int id2;
        int emptySpace;
        int prioritySum;
        int time;
    };
    
using namespace std;

namespace AAM{
class AutoAlbumMaker {
public:
    AutoAlbumMaker();
    AutoAlbumMaker(const AutoAlbumMaker& orig);
    virtual ~AutoAlbumMaker();
    void setPageDimensions(int widht, int height);
    void setMaxNumberOfPages(int mnop);
    void setMaxNumberOfPhotosInPage(int mnopip);
    void generateAlbum();
    void setImagePathList(vector<string> imagelist);
    void setRenderer(Renderer *h);
    void setOutputFilename(string outputFilename);
	void setSelection(bool selection);
private:
    vector<AAM::Imagens*> loadImagesAndProcessExif();
    Document* groupImages(vector<AAM::Imagens*>);
    static bool comparaHoraImagens(Imagens* a, Imagens *b);
    void doLayout(Document *d);
    Renderer* renderer;
    vector<string> imageList;
    string outputFilename;
    int regionsX;
    int regionsY;
    int numRegions;
    int maxNumberOfPages;
    int maxNumberOfPhotosPerPage;
    int idCounter;
    HistogramComparison *histComp;
    int minNumberOfClusters;
	int pageWidth;
	int pageHeight;
    bool selectPhotos;
    bool autoOrganizePhotos;
    bool allowCropping;
    void reduceEvents(vector<Page*> &vec);
    static bool compareSpace(Pontuation a, Pontuation b);
    static bool comparePriority(Pontuation a, Pontuation b);
	bool selection;
	void timeBlocksToPages(vector<TimeBlock*> tb, Document *d);
	void timeBlockAsPage(TimeBlock *tb, Document *d);
};
}
#endif	/* AUTOALBUMMAKER_H */

